<!DOCTYPE html>


<html lang="en">
  

    <head>
      <meta charset="utf-8" />
        
      <meta
        name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1"
      />
      <title>php编译参数详解 |  麦田麦穗</title>
  <meta name="generator" content="hexo-theme-ayer">
      
      <link rel="shortcut icon" href="/favicon.ico" />
       
<link rel="stylesheet" href="/dist/main.css">

      <link
        rel="stylesheet"
        href="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/css/remixicon.min.css"
      />
      
<link rel="stylesheet" href="/css/custom.css">
 
      <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
       
 

      <link
        rel="stylesheet"
        href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-bulma@5.0.1/bulma.min.css"
      />
      <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.19/dist/sweetalert2.min.js"></script>

      <!-- mermaid -->
      
      <style>
        .swal2-styled.swal2-confirm {
          font-size: 1.6rem;
        }
      </style>
    </head>
  </html>
</html>


<body>
  <div id="app">
    
      
    <main class="content on">
      <section class="outer">
  <article
  id="post-php/php编译参数详解"
  class="article article-type-post"
  itemscope
  itemprop="blogPost"
  data-scroll-reveal
>
  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  php编译参数详解
</h1>
 

      
    </header>
     
    <div class="article-meta">
      <a href="/2020/09/03/php/php%E7%BC%96%E8%AF%91%E5%8F%82%E6%95%B0%E8%AF%A6%E8%A7%A3/" class="article-date">
  <time datetime="2020-09-03T02:19:37.000Z" itemprop="datePublished">2020-09-03</time>
</a>   
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> Word count:</span>
            <span class="post-count">3.1k</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> Reading time≈</span>
            <span class="post-count">18 min</span>
        </span>
    </span>
</div>
 
    </div>
      
    <div class="tocbot"></div>




  
    <div class="article-entry" itemprop="articleBody">
       
  <p>尽管经历了N次的手动编译，你可能还是不知道哪些编译参数需要哪些不需要</p>
<span id="more"></span>

<h2 id="help"><a href="#help" class="headerlink" title="help"></a>help</h2><p>执行帮助命令查看编译配置帮助</p>
<pre class="language-none"><code class="language-none">.&#x2F;configure --help&#x3D;short</code></pre>

<p>得到结果</p>
<pre class="language-none"><code class="language-none">Optional Features and Packages:
  --disable-option-checking  ignore unrecognized --enable&#x2F;--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE&#x3D;no)
  --enable-FEATURE[&#x3D;ARG]  include FEATURE [ARG&#x3D;yes]
  --with-PACKAGE[&#x3D;ARG]    use PACKAGE [ARG&#x3D;yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE&#x3D;no)
  --with-libdir&#x3D;NAME      Look for libraries in ...&#x2F;NAME rather than ...&#x2F;lib
  --disable-rpath         Disable passing additional runtime library
                          search paths
  --enable-re2c-cgoto     Enable -g flag to re2c to use computed goto gcc extension
  --disable-gcc-global-regs
                          whether to enable GCC global register variables

SAPI modules:

  --with-apxs2&#x3D;FILE       Build shared Apache 2.0 Handler module. FILE is the optional
                          pathname to the Apache apxs tool apxs
  --disable-cli           Disable building CLI version of PHP
                          (this forces --without-pear)
  --enable-embed&#x3D;TYPE     EXPERIMENTAL: Enable building of embedded SAPI library
                          TYPE is either &#39;shared&#39; or &#39;static&#39;. TYPE&#x3D;shared
  --enable-fpm            Enable building of the fpm SAPI executable  fastcgi进程管理,这个应该必不可少
  --with-fpm-user&#x3D;USER    Set the user for php-fpm to run as. (default: nobody)
  --with-fpm-group&#x3D;GRP    Set the group for php-fpm to run as. For a system user, this
                          should usually be set to match the fpm username (default: nobody)
  --with-fpm-systemd      Activate systemd integration
  --with-fpm-acl          Use POSIX Access Control Lists
  --with-litespeed        Build PHP as litespeed module
  --enable-phpdbg            Build phpdbg
  --enable-phpdbg-webhelper  Build phpdbg web SAPI support
  --enable-phpdbg-debug      Build phpdbg in debug mode
  --enable-phpdbg-readline   Enable readline support in phpdbg (depends on static ext&#x2F;readline)
  --disable-cgi           Disable building CGI version of PHP   禁用cgi
  --with-valgrind&#x3D;DIR     Enable valgrind support

General settings:

  --enable-gcov           Enable GCOV code coverage (requires LTP) - FOR DEVELOPERS ONLY!!
  --enable-debug          Compile with debugging symbols
  --with-layout&#x3D;TYPE      Set how installed files will be laid out.  Type can
                          be either PHP or GNU [PHP]
  --with-config-file-path&#x3D;PATH
                          Set the path in which to look for php.ini [PREFIX&#x2F;lib]
  --with-config-file-scan-dir&#x3D;PATH
                          Set the path where to scan for configuration files
  --enable-sigchild       Enable PHP&#39;s own SIGCHLD handler
  --enable-libgcc         Enable explicitly linking against libgcc
  --disable-short-tags    Disable the short-form &lt;? start tag by default
  --enable-dmalloc        Enable dmalloc
  --disable-ipv6          Disable IPv6 support
  --enable-dtrace         Enable DTrace support
  --enable-fd-setsize     Set size of descriptor sets

Extensions:

  --with-EXTENSION&#x3D;shared[,PATH]

    NOTE: Not all extensions can be build as &#39;shared&#39;.

    Example: --with-foobar&#x3D;shared,&#x2F;usr&#x2F;local&#x2F;foobar&#x2F;

      o Builds the foobar extension as shared extension.
      o foobar package install prefix is &#x2F;usr&#x2F;local&#x2F;foobar&#x2F;


  --disable-all           Disable all extensions which are enabled by default

  --disable-libxml        Disable LIBXML support
  --with-libxml-dir&#x3D;DIR   LIBXML: libxml2 install prefix
  --with-openssl&#x3D;DIR      Include OpenSSL support (requires OpenSSL &gt;&#x3D; 1.0.1)
  --with-kerberos&#x3D;DIR     OPENSSL: Include Kerberos support
  --with-system-ciphers   OPENSSL: Use system default cipher list instead of hardcoded value
  --with-pcre-regex&#x3D;DIR   Include Perl Compatible Regular Expressions support.
                          DIR is the PCRE install prefix BUNDLED
  --with-pcre-jit         Enable PCRE JIT functionality (BUNDLED only)
  --with-pcre-valgrind&#x3D;DIR
                          Enable PCRE valgrind support. Developers only!
  --without-sqlite3&#x3D;DIR   Do not include SQLite3 support. DIR is the prefix to
                          SQLite3 installation directory.
  --with-zlib&#x3D;DIR         Include ZLIB support (requires zlib &gt;&#x3D; 1.2.0.4)
  --with-zlib-dir&#x3D;&lt;DIR&gt;   Define the location of zlib install directory
  --enable-bcmath         Enable bc style precision math functions
  --with-bz2&#x3D;DIR          Include BZip2 support
  --enable-calendar       Enable support for calendar conversion
  --disable-ctype         Disable ctype functions
  --with-curl&#x3D;DIR         Include cURL support
  --enable-dba            Build DBA with bundled modules. To build shared DBA
                          extension use --enable-dba&#x3D;shared
  --with-qdbm&#x3D;DIR         DBA: QDBM support
  --with-gdbm&#x3D;DIR         DBA: GDBM support
  --with-ndbm&#x3D;DIR         DBA: NDBM support
  --with-db4&#x3D;DIR          DBA: Oracle Berkeley DB 4.x or 5.x support
  --with-db3&#x3D;DIR          DBA: Oracle Berkeley DB 3.x support
  --with-db2&#x3D;DIR          DBA: Oracle Berkeley DB 2.x support
  --with-db1&#x3D;DIR          DBA: Oracle Berkeley DB 1.x support&#x2F;emulation
  --with-dbm&#x3D;DIR          DBA: DBM support
  --with-tcadb&#x3D;DIR        DBA: Tokyo Cabinet abstract DB support
  --with-lmdb&#x3D;DIR        DBA: Lightning memory-mapped database support
  --without-cdb&#x3D;DIR       DBA: CDB support (bundled)
  --disable-inifile       DBA: INI support (bundled)
  --disable-flatfile      DBA: FlatFile support (bundled)
  --disable-dom           Disable DOM support
  --with-libxml-dir&#x3D;DIR   DOM: libxml2 install prefix
  --with-enchant&#x3D;DIR      Include enchant support.
                          GNU Aspell version 1.1.3 or higher required.
  --enable-exif           Enable EXIF (metadata from images) support
  --disable-fileinfo      Disable fileinfo support
  --disable-filter        Disable input filter support
  --with-pcre-dir         FILTER: pcre install prefix
  --enable-ftp            Enable FTP support
  --with-openssl-dir&#x3D;DIR  FTP: openssl install prefix
  --with-gd&#x3D;DIR           Include GD support.  DIR is the GD library base
                          install directory BUNDLED
  --with-webp-dir&#x3D;DIR      GD: Set the path to libwebp install prefix
  --with-jpeg-dir&#x3D;DIR     GD: Set the path to libjpeg install prefix
  --with-png-dir&#x3D;DIR      GD: Set the path to libpng install prefix
  --with-zlib-dir&#x3D;DIR     GD: Set the path to libz install prefix
  --with-xpm-dir&#x3D;DIR      GD: Set the path to libXpm install prefix
  --with-freetype-dir&#x3D;DIR GD: Set the path to FreeType 2 install prefix
  --enable-gd-jis-conv    GD: Enable JIS-mapped Japanese font support
  --with-gettext&#x3D;DIR      Include GNU gettext support
  --with-gmp&#x3D;DIR          Include GNU MP support
  --with-mhash&#x3D;DIR        Include mhash support
  --disable-hash          Disable hash support
  --without-iconv&#x3D;DIR     Exclude iconv support
  --with-imap&#x3D;DIR         Include IMAP support. DIR is the c-client install prefix
  --with-kerberos&#x3D;DIR     IMAP: Include Kerberos support. DIR is the Kerberos install prefix
  --with-imap-ssl&#x3D;DIR     IMAP: Include SSL support. DIR is the OpenSSL install prefix
  --with-interbase&#x3D;DIR    Include Firebird support.  DIR is the Firebird base
                          install directory &#x2F;opt&#x2F;firebird
  --enable-intl           Enable internationalization support
  --with-icu-dir&#x3D;DIR      Specify where ICU libraries and headers can be found
  --disable-json          Disable JavaScript Object Serialization support
  --with-ldap&#x3D;DIR         Include LDAP support
  --with-ldap-sasl&#x3D;DIR    LDAP: Include Cyrus SASL support
  --enable-mbstring       Enable multibyte string support
  --disable-mbregex       MBSTRING: Disable multibyte regex support
  --disable-mbregex-backtrack
                          MBSTRING: Disable multibyte regex backtrack check
  --with-libmbfl&#x3D;DIR      MBSTRING: Use external libmbfl.  DIR is the libmbfl base
                          install directory BUNDLED
  --with-onig&#x3D;DIR         MBSTRING: Use external oniguruma. DIR is the oniguruma install prefix.
                          If DIR is not set, the bundled oniguruma will be used
  --with-mysqli&#x3D;FILE      Include MySQLi support.  FILE is the path
                          to mysql_config.  If no value or mysqlnd is passed
                          as FILE, the MySQL native driver will be used
  --enable-embedded-mysqli
                          MYSQLi: Enable embedded support
                          Note: Does not work with MySQL native driver!
  --with-mysql-sock&#x3D;SOCKPATH
                          MySQLi&#x2F;PDO_MYSQL: Location of the MySQL unix socket pointer.
                          If unspecified, the default locations are searched
  --with-oci8&#x3D;DIR         Include Oracle Database OCI8 support. DIR defaults to $ORACLE_HOME.
                          Use --with-oci8&#x3D;instantclient,&#x2F;path&#x2F;to&#x2F;instant&#x2F;client&#x2F;lib
                          to use an Oracle Instant Client installation
  --with-odbcver&#x3D;HEX      Force support for the passed ODBC version. A hex number is expected, default 0x0350.
                             Use the special value of 0 to prevent an explicit ODBCVER to be defined.
  --with-adabas&#x3D;DIR       Include Adabas D support &#x2F;usr&#x2F;local
  --with-sapdb&#x3D;DIR        Include SAP DB support &#x2F;usr&#x2F;local
  --with-solid&#x3D;DIR        Include Solid support &#x2F;usr&#x2F;local&#x2F;solid
  --with-ibm-db2&#x3D;DIR      Include IBM DB2 support &#x2F;home&#x2F;db2inst1&#x2F;sqllib
  --with-ODBCRouter&#x3D;DIR   Include ODBCRouter.com support &#x2F;usr
  --with-empress&#x3D;DIR      Include Empress support \$EMPRESSPATH
                          (Empress Version &gt;&#x3D; 8.60 required)
  --with-empress-bcs&#x3D;DIR
                          Include Empress Local Access support \$EMPRESSPATH
                          (Empress Version &gt;&#x3D; 8.60 required)
  --with-birdstep&#x3D;DIR     Include Birdstep support &#x2F;usr&#x2F;local&#x2F;birdstep
  --with-custom-odbc&#x3D;DIR  Include user defined ODBC support. DIR is ODBC install base
                          directory &#x2F;usr&#x2F;local. Make sure to define CUSTOM_ODBC_LIBS and
                          have some odbc.h in your include dirs. f.e. you should define
                          following for Sybase SQL Anywhere 5.5.00 on QNX, prior to
                          running this configure script:
                            CPPFLAGS&#x3D;\&quot;-DODBC_QNX -DSQLANY_BUG\&quot;
                            LDFLAGS&#x3D;-lunix
                            CUSTOM_ODBC_LIBS&#x3D;\&quot;-ldblib -lodbc\&quot;
  --with-iodbc&#x3D;DIR        Include iODBC support &#x2F;usr&#x2F;local
  --with-esoob&#x3D;DIR        Include Easysoft OOB support &#x2F;usr&#x2F;local&#x2F;easysoft&#x2F;oob&#x2F;client
  --with-unixODBC&#x3D;DIR     Include unixODBC support &#x2F;usr&#x2F;local
  --with-dbmaker&#x3D;DIR      Include DBMaker support
  --disable-opcache       Disable Zend OPcache support
  --disable-opcache-file  Disable file based caching
  --disable-huge-code-pages
                          Disable copying PHP CODE pages into HUGE PAGES
  --enable-pcntl          Enable pcntl support (CLI&#x2F;CGI only)
  --disable-pdo           Disable PHP Data Objects support
  --with-pdo-dblib&#x3D;DIR    PDO: DBLIB-DB support.  DIR is the FreeTDS home directory
  --with-pdo-firebird&#x3D;DIR PDO: Firebird support.  DIR is the Firebird base
                          install directory &#x2F;opt&#x2F;firebird
  --with-pdo-mysql&#x3D;DIR    PDO: MySQL support. DIR is the MySQL base directory
                          If no value or mysqlnd is passed as DIR, the
                          MySQL native driver will be used
  --with-zlib-dir&#x3D;DIR     PDO_MySQL: Set the path to libz install prefix
  --with-pdo-oci&#x3D;DIR      PDO: Oracle OCI support. DIR defaults to $ORACLE_HOME.
                          Use --with-pdo-oci&#x3D;instantclient,&#x2F;path&#x2F;to&#x2F;instant&#x2F;client&#x2F;lib
                          for an Oracle Instant Client installation.
  --with-pdo-odbc&#x3D;flavour,dir
                          PDO: Support for &#39;flavour&#39; ODBC driver.
			  include and lib dirs are looked for under &#39;dir&#39;.

			  &#39;flavour&#39; can be one of:  ibm-db2, iODBC, unixODBC, generic
			  If &#39;,dir&#39; part is omitted, default for the flavour
			  you have selected will be used. e.g.:

			    --with-pdo-odbc&#x3D;unixODBC

			  will check for unixODBC under &#x2F;usr&#x2F;local. You may attempt
			  to use an otherwise unsupported driver using the \&quot;generic\&quot;
			  flavour.  The syntax for generic ODBC support is:

			    --with-pdo-odbc&#x3D;generic,dir,libname,ldflags,cflags

			  When built as &#39;shared&#39; the extension filename is always pdo_odbc.so
  --with-pdo-pgsql&#x3D;DIR    PDO: PostgreSQL support.  DIR is the PostgreSQL base
                          install directory or the path to pg_config
  --without-pdo-sqlite&#x3D;DIR
                          PDO: sqlite 3 support.  DIR is the sqlite base
                          install directory BUNDLED
  --with-pgsql&#x3D;DIR        Include PostgreSQL support.  DIR is the PostgreSQL
                          base install directory or the path to pg_config
  --disable-phar          Disable phar support
  --disable-posix         Disable POSIX-like functions
  --with-pspell&#x3D;DIR       Include PSPELL support.
                          GNU Aspell version 0.50.0 or higher required
  --with-libedit&#x3D;DIR      Include libedit readline replacement (CLI&#x2F;CGI only)
  --with-readline&#x3D;DIR     Include readline support (CLI&#x2F;CGI only)
  --with-recode&#x3D;DIR       Include recode support
  --disable-session       Disable session support
  --with-mm&#x3D;DIR           SESSION: Include mm support for session storage
  --enable-shmop          Enable shmop support
  --disable-simplexml     Disable SimpleXML support
  --with-libxml-dir&#x3D;DIR   SimpleXML: libxml2 install prefix
  --with-snmp&#x3D;DIR         Include SNMP support
  --with-openssl-dir&#x3D;DIR  SNMP: openssl install prefix
  --enable-soap           Enable SOAP support
  --with-libxml-dir&#x3D;DIR   SOAP: libxml2 install prefix
  --enable-sockets        Enable sockets support
  --with-sodium&#x3D;DIR     Include sodium support
  --with-password-argon2&#x3D;DIR           Include Argon2 support in password_*. DIR is the Argon2 shared library path]
  --enable-sysvmsg        Enable sysvmsg support
  --enable-sysvsem        Enable System V semaphore support
  --enable-sysvshm        Enable the System V shared memory support
  --with-tidy&#x3D;DIR         Include TIDY support
  --disable-tokenizer     Disable tokenizer support
  --enable-wddx           Enable WDDX support
  --with-libxml-dir&#x3D;DIR   WDDX: libxml2 install prefix
  --with-libexpat-dir&#x3D;DIR WDDX: libexpat dir for XMLRPC-EPI (deprecated)
  --disable-xml           Disable XML support
  --with-libxml-dir&#x3D;DIR   XML: libxml2 install prefix
  --with-libexpat-dir&#x3D;DIR XML: libexpat install prefix (deprecated)
  --disable-xmlreader     Disable XMLReader support
  --with-libxml-dir&#x3D;DIR   XMLReader: libxml2 install prefix
  --with-xmlrpc&#x3D;DIR       Include XMLRPC-EPI support
  --with-libxml-dir&#x3D;DIR   XMLRPC-EPI: libxml2 install prefix
  --with-libexpat-dir&#x3D;DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI (deprecated)
  --with-iconv-dir&#x3D;DIR    XMLRPC-EPI: iconv dir for XMLRPC-EPI
  --disable-xmlwriter     Disable XMLWriter support
  --with-libxml-dir&#x3D;DIR   XMLWriter: libxml2 install prefix
  --with-xsl&#x3D;DIR          Include XSL support.  DIR is the libxslt base
                          install directory (libxslt &gt;&#x3D; 1.1.0 required)
  --enable-zend-test           Enable zend-test extension
  --enable-zip            Include Zip read&#x2F;write support
  --with-zlib-dir&#x3D;DIR     ZIP: Set the path to libz install prefix
  --with-pcre-dir         ZIP: pcre install prefix
  --with-libzip&#x3D;DIR       ZIP: use libzip
  --enable-mysqlnd        Enable mysqlnd explicitly, will be done implicitly
                          when required by other extensions
  --disable-mysqlnd-compression-support
                          Disable support for the MySQL compressed protocol in mysqlnd
  --with-zlib-dir&#x3D;DIR     mysqlnd: Set the path to libz install prefix

PEAR:

  --with-pear&#x3D;DIR         Install PEAR in DIR [PREFIX&#x2F;lib&#x2F;php]
  --without-pear          Do not install PEAR

Zend:

  --enable-maintainer-zts Enable thread safety - for code maintainers only!!
  --disable-inline-optimization
                          If building zend_execute.lo fails, try this switch
  --disable-zend-signals  whether to enable zend signal handling

TSRM:

  --with-tsrm-pth&#x3D;pth-config
                          Use GNU Pth
  --with-tsrm-st          Use SGI&#39;s State Threads
  --with-tsrm-pthreads    Use POSIX threads (default)

Libtool:

  --enable-shared&#x3D;PKGS    Build shared libraries default&#x3D;yes
  --enable-static&#x3D;PKGS    Build static libraries default&#x3D;yes
  --enable-fast-install&#x3D;PKGS
                          Optimize for fast installation default&#x3D;yes
  --with-gnu-ld           Assume the C compiler uses GNU ld default&#x3D;no
  --disable-libtool-lock  Avoid locking (might break parallel builds)
  --with-pic              Try to use only PIC&#x2F;non-PIC objects default&#x3D;use both
  --with-tags&#x3D;TAGS        Include additional configurations automatic


Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L&lt;lib dir&gt; if you have libraries in a
              nonstandard directory &lt;lib dir&gt;
  LIBS        libraries to pass to the linker, e.g. -l&lt;library&gt;
  CPPFLAGS    (Objective) C&#x2F;C++ preprocessor flags, e.g. -I&lt;include dir&gt; if
              you have headers in a nonstandard directory &lt;include dir&gt;
  CPP         C preprocessor
  YACC        The &#96;Yet Another Compiler Compiler&#39; implementation to use.
              Defaults to the first program found out of: &#96;bison -y&#39;, &#96;byacc&#39;,
              &#96;yacc&#39;.
  YFLAGS      The list of arguments that will be passed by default to $YACC.
              This script will default YFLAGS to the empty string to avoid a
              default value of &#96;-d&#39; given by some make applications.
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags
  CXXCPP      C++ preprocessor

Use these variables to override the choices made by &#96;configure&#39; or to help
it to find libraries and programs with nonstandard names&#x2F;locations.
</code></pre>

<h2 id="默认拓展"><a href="#默认拓展" class="headerlink" title="默认拓展"></a>默认拓展</h2><p>当不配置任何参数时，它默认会有哪些拓展呢？</p>
<pre class="language-none"><code class="language-none">php -m</code></pre>

<pre class="language-none"><code class="language-none">[PHP Modules]
Core
ctype
date
dom
fileinfo
filter
hash
iconv
json
libxml
pcre
PDO
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter

[Zend Modules]</code></pre>
<p>此时你会发现连<code>php-fpm</code>都没有</p>
<h2 id="常用配置"><a href="#常用配置" class="headerlink" title="常用配置"></a>常用配置</h2><h3 id="依赖安装"><a href="#依赖安装" class="headerlink" title="依赖安装"></a>依赖安装</h3><pre class="language-none"><code class="language-none">yum install -y libxml2-devel openssl-devel</code></pre>

<pre class="language-none"><code class="language-none">.&#x2F;configure --enable-fpm  --enable-bcmath  --with-openssl \
--enable-mbstring --with-mysqli --enable-mysqlnd</code></pre>



<h3 id="编译安装"><a href="#编译安装" class="headerlink" title="编译安装"></a>编译安装</h3><pre class="language-none"><code class="language-none">make &amp;&amp; make install</code></pre>

<h2 id="启动"><a href="#启动" class="headerlink" title="启动"></a>启动</h2><h3 id="查看ini配置"><a href="#查看ini配置" class="headerlink" title="查看ini配置"></a>查看ini配置</h3><pre class="language-none"><code class="language-none">php -ini | grep &#39;ini&#39;</code></pre>

<pre class="language-none"><code class="language-none">Configuration File (php.ini) Path &#x3D;&gt; &#x2F;usr&#x2F;local&#x2F;lib
Loaded Configuration File &#x3D;&gt; &#x2F;usr&#x2F;local&#x2F;lib&#x2F;php.ini
Scan this dir for additional .ini files &#x3D;&gt; (none)
Additional .ini files parsed &#x3D;&gt; (none)
user_ini.cache_ttl &#x3D;&gt; 300 &#x3D;&gt; 300
user_ini.filename &#x3D;&gt; .user.ini &#x3D;&gt; .user.ini
init_command_executed_count &#x3D;&gt; 0
init_command_failed_count &#x3D;&gt; 0
com_init_db &#x3D;&gt; 0</code></pre>
<p>从源代码目录 复制配置文件到<code>Configuration File (php.ini) Path</code></p>
<pre class="language-none"><code class="language-none">cp php.ini-production &#x2F;usr&#x2F;local&#x2F;lib&#x2F;php.ini</code></pre>

<h2 id="设置服务-amp-开机启动-centos-7"><a href="#设置服务-amp-开机启动-centos-7" class="headerlink" title="设置服务&amp;开机启动(centos 7+)"></a>设置服务&amp;开机启动(centos 7+)</h2><p>服务服务脚本到systemd</p>
<pre class="language-none"><code class="language-none">cp sapi&#x2F;fpm&#x2F;php-fpm.service &#x2F;etc&#x2F;systemd&#x2F;system&#x2F;
</code></pre>
<p>查看启动脚本</p>
<pre class="language-none"><code class="language-none">cat sapi&#x2F;fpm&#x2F;php-fpm.service</code></pre>

<p>结果</p>
<pre class="language-none"><code class="language-none"># It&#39;s not recommended to modify this file in-place, because it
# will be overwritten during upgrades.  If you want to customize,
# the best way is to use the &quot;systemctl edit&quot; command.

[Unit]
Description&#x3D;The PHP FastCGI Process Manager
After&#x3D;network.target

[Service]
Type&#x3D;simple
PIDFile&#x3D;&#x2F;usr&#x2F;local&#x2F;var&#x2F;run&#x2F;php-fpm.pid
ExecStart&#x3D;&#x2F;usr&#x2F;local&#x2F;sbin&#x2F;php-fpm --nodaemonize --fpm-config &#x2F;usr&#x2F;local&#x2F;etc&#x2F;php-fpm.conf
ExecReload&#x3D;&#x2F;bin&#x2F;kill -USR2 $MAINPID
PrivateTmp&#x3D;true

[Install]
WantedBy&#x3D;multi-user.target</code></pre>

<h3 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h3><pre class="language-none"><code class="language-none">cp sapi&#x2F;fpm&#x2F;php-fpm.conf &#x2F;usr&#x2F;local&#x2F;etc&#x2F;php-fpm.conf
</code></pre>
<p>修改php-fpm.conf 相应配置使得PIDFile文件位置与php-fpm.service配置的一致。并复制<a target="_blank" rel="noopener" href="http://www.conf到对应目录">www.conf到对应目录</a></p>
<h3 id="启动-1"><a href="#启动-1" class="headerlink" title="启动"></a>启动</h3><pre class="language-none"><code class="language-none">systemctl daemon-reload
systemctl start php-fpm.service
systemctl status php-fpm.service
systemctl enable php-fpm.service</code></pre>





 
      <!-- reward -->
      
      <div id="reword-out">
        <div id="reward-btn">
          Donate
        </div>
      </div>
      
    </div>
    

    <!-- copyright -->
    
    <div class="declare">
      <ul class="post-copyright">
        <li>
          <i class="ri-copyright-line"></i>
          <strong>Copyright： </strong>
          
          Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
          
        </li>
      </ul>
    </div>
    
    <footer class="article-footer">
       
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=http://visonforcoding.xyz/2020/09/03/php/php%E7%BC%96%E8%AF%91%E5%8F%82%E6%95%B0%E8%AF%A6%E8%A7%A3/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>  
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/php/" rel="tag">php</a></li></ul>

    </footer>
  </div>

   
  <nav class="article-nav">
    
      <a href="/2020/09/09/java/IOC%E5%92%8Cspring%E5%AF%B9%E5%AE%83%E7%9A%84%E5%AE%9E%E7%8E%B0/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            IOC和spring对它的实现
          
        </div>
      </a>
    
    
      <a href="/2020/09/02/supervisor%E4%BD%BF%E7%94%A8/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">supervisor使用</div>
      </a>
    
  </nav>

   
<!-- valine评论 -->
<div id="vcomments-box">
  <div id="vcomments"></div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/valine@1.4.14/dist/Valine.min.js"></script>
<script>
  new Valine({
    el: "#vcomments",
    app_id: "",
    app_key: "",
    path: window.location.pathname,
    avatar: "monsterid",
    placeholder: "给我的文章加点评论吧~",
    recordIP: true,
  });
  const infoEle = document.querySelector("#vcomments .info");
  if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
    infoEle.childNodes.forEach(function (item) {
      item.parentNode.removeChild(item);
    });
  }
</script>
<style>
  #vcomments-box {
    padding: 5px 30px;
  }

  @media screen and (max-width: 800px) {
    #vcomments-box {
      padding: 5px 0px;
    }
  }

  #vcomments-box #vcomments {
    background-color: #fff;
  }

  .v .vlist .vcard .vh {
    padding-right: 20px;
  }

  .v .vlist .vcard {
    padding-left: 10px;
  }
</style>

 
   
     
</article>

</section>
      <footer class="footer">
  <div class="outer">
    <ul>
      <li>
        Copyrights &copy;
        2015-2022
        <i class="ri-heart-fill heart_icon"></i> vison
      </li>
    </ul>
    <ul>
      <li>
        
      </li>
    </ul>
    <ul>
      <li>
        
        
        <span>
  <span><i class="ri-user-3-fill"></i>Visitors:<span id="busuanzi_value_site_uv"></span></span>
  <span class="division">|</span>
  <span><i class="ri-eye-fill"></i>Views:<span id="busuanzi_value_page_pv"></span></span>
</span>
        
      </li>
    </ul>
    <ul>
      
    </ul>
    <ul>
      
    </ul>
    <ul>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>    
    </main>
    <div class="float_btns">
      <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>

    </div>
    <aside class="sidebar on">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="麦田麦穗"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E6%97%85%E8%A1%8C/">旅行</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" target="_blank" rel="noopener" href="http://shenyu-vip.lofter.com">摄影</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/friends">友链</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/about">关于我</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/null">Gallery</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>Buy me a cup of coffee~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpeg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wallet.png">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/js/jquery-3.6.0.min.js"></script>
 
<script src="/js/lazyload.min.js"></script>

<!-- Tocbot -->
 
<script src="/js/tocbot.min.js"></script>

<script>
  tocbot.init({
    tocSelector: ".tocbot",
    contentSelector: ".article-entry",
    headingSelector: "h1, h2, h3, h4, h5, h6",
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: "main",
    positionFixedSelector: ".tocbot",
    positionFixedClass: "is-position-fixed",
    fixedSidebarOffset: "auto",
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css"
/>
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/dist/main.js"></script>

<!-- ImageViewer -->
 <!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script> 
<!-- MathJax -->

<!-- Katex -->

<!-- busuanzi  -->
 
<script src="/js/busuanzi-2.3.pure.min.js"></script>
 
<!-- ClickLove -->

<!-- ClickBoom1 -->

<!-- ClickBoom2 -->

<!-- CodeCopy -->
 
<link rel="stylesheet" href="/css/clipboard.css">
 <script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script>
  function wait(callback, seconds) {
    var timelag = null;
    timelag = window.setTimeout(callback, seconds);
  }
  !function (e, t, a) {
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '<i class="ri-file-copy-2-line"></i><span>COPY</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      $(".article pre code").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });
      clipboard.on('success', function(e) {
        let $btn = $(e.trigger);
        $btn.addClass('copied');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-checkbox-circle-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPIED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-checkbox-circle-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
      clipboard.on('error', function(e) {
        e.clearSelection();
        let $btn = $(e.trigger);
        $btn.addClass('copy-failed');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-time-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPY FAILED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-time-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
    }
    initCopyCode();
  }(window, document);
</script>
 
<!-- CanvasBackground -->

<script>
  if (window.mermaid) {
    mermaid.initialize({ theme: "forest" });
  }
</script>


    
    

  </div>
</body>

</html>